package com.dawnling.countdownlistdemo.base;

import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;

public abstract class BaseFragment extends Fragment {

    //离开fragment的时间 onStop
    protected long leaveTime;
    //错过的时间
    protected long missTime;
    protected Handler mHandler;

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        mHandler = new Handler();
    }

    @Override
    public void onStart() {
        super.onStart();
        //计算错过的时间
        if (leaveTime != 0L) {
            missTime = System.currentTimeMillis() - leaveTime;
        }
    }

    @Override
    public void onStop() {
        super.onStop();
        leaveTime = System.currentTimeMillis();
    }
}
